package com.atguigu.day14.exer.e1;

import org.junit.Test;

import java.util.GregorianCalendar;
import java.util.Scanner;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/16 10:50
 * @注释
 */
public class MonthTest {


    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        //获取年份
        System.out.println("请输入年份:");
        int year = input.nextInt();
        //获取月份
        System.out.println("请输入月份:");
        int month = input.nextInt();
        //调用方法获取制定的月份对象
        Month m = Month.getByValue(month);
        System.out.println(m);
        //判断是否为闰年
        boolean leapYear = year % 4 == 0 && year % 100 != 0 || year % 400 == 0;
        //获取月份天数资源
        int days = m.length(leapYear);
        //关闭资源
        input.close();
    }


}
